package com.cgw.dmplt.room.dao.ibatis;

import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.cgw.dmplt.room.domain.Room;
import com.cgw.dmplt.room.dao.RoomDao;

/**
 *
 */
public class RoomDaoImpl extends SqlMapClientDaoSupport implements RoomDao
{
    
    /**
     * insert.
     * @param room room
     * @return id
     * @ DataAccessException
     */
    public String insertRoom(Room room) {
    	getSqlMapClientTemplate().insert("Room_insertRoom", room);
    	return "";
    }

    /**
     * delete.
     * @param room room
     */
    public void deleteRoom(Room room) {
        getSqlMapClientTemplate().update("Room_deleteRoom", room);
    }
    
    /**
     * update.
     * @param room room
     */
    public void updateRoom(Room room) {
    	getSqlMapClientTemplate().update("Room_updateRoom", room);
    }
    
    /**
     * find.
     * @param id id
     * @return room
     */
    public Room findRoom(Integer pk) {
        Room room = (Room) getSqlMapClientTemplate().queryForObject("Room_findRoom", pk);
        if(room!=null){
        	
        }
        return room;
    }
    
    /**
     * list.
     * @param room room
     * @return room list
     */
    public List listRoom(Room room) {
        List list = getSqlMapClientTemplate().queryForList("Room_listRoom", room);
        return list;
    }  
    
    /**
     * listCount.
     * @param room room
     * @return list count
     */
    public Integer listRoomCount(Room room) {
        Integer count = (Integer)getSqlMapClientTemplate().queryForObject("Room_listRoomCount", room);
        return count;
    }  
}
